
let re=document.querySelector('.return')
let xhr2=new XMLHttpRequest()
xhr2.open('get',`http://chst.vip:1234/api/getcategorybyid?categoryid=${localStorage.getItem('categoryId')}&productid=${localStorage.getItem('productid')}`,true)
xhr2.onload=function(){
    if(xhr2.status===200){
        let res =JSON.parse(xhr2.responseText)
        let an=res.result
        let lis=''
        an.forEach(item=>{
            lis+=`
            <a href="">首页></a>
            <a href="http://127.0.0.1:5500/js/day18/html/paging.html">${item.category}></a>
            <a href="">${localStorage.getItem('brandName1')}</a>
            <p>筛选</p> 
            `
        })
        re.innerHTML=lis
    }
}
xhr2.send(null)


// 内容栏渲染
let main=document.querySelector('.main')
let xhr=new XMLHttpRequest()
xhr.open('get',`http://chst.vip:1234/api/getproduct?productid=${localStorage.getItem('productid')}`,true)
xhr.onload=function(){
    if(xhr.status===200){
        let res =JSON.parse(xhr.responseText)
        let an=res.result
        let lis=''
        an.forEach(item => {
            lis+=`
            ${item.productImg}
            <div class="maina">
                <h4>${item.productName}</h4>
                ${item.bjShop}
            </div>  
            `
        });
        main.innerHTML=lis
    }
}
xhr.send(null)


// 评论栏渲染
let commentsul=document.querySelector('.comments ul')
let xhr1=new XMLHttpRequest()
xhr1.open('get',`http://chst.vip:1234/api/getproductcom?productid=${localStorage.getItem('productid')}`,true)
xhr1.onload=function(){
    if(xhr.status===200){
        let res =JSON.parse(xhr1.responseText)
        let an=res.result
        let lis=''
        an.forEach(item => {
            lis+=`
            <li>
            <div class="one">
                <p>${item.comName}</p>
                <p>${item.comTime}</p>
            </div>
            <div class="two">
                ${item.comContent}
            </div>
            <div class="three">
                ${item.comFrom}
            </div>

        </li>  
            `
        });
        commentsul.innerHTML=lis
    }
}
xhr1.send(null)